package com.sui.bigdata.sml.web.repository.mapper;

import com.sui.bigdata.sml.web.repository.model.Project;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author songhaicheng
 * @date 2019/11/5 10:00
 * @description
 * @reviewer
 */
@Repository
public interface ProjectMapper {

    @Insert("insert into project(name,user_id) values(#{name},#{userId})")
    @Options(useGeneratedKeys = true)
    int insert(Project project);

    @Update("update project set name=#{name} where id=#{id}")
    int update(Project project);

    @Select("select * from project where id=#{id}")
    Project get(Long id);

    @Select("select * from project")
    List<Project> listByUserId(Long userId);

    @Delete("delete from project where id=#{id}")
    int delete(Long id);

}
